//三级分类导航选择器相关的接口函数

//导入二次封装axios
import request from "@/utils/request";
import type { CategoryList } from "./models/categoryModel";

// 使用枚举定义接口地址,方便后续修改
enum Api {
  category1ListUrl='/admin/product/getCategory1',
  category2ListUrl='/admin/product/getCategory2',
  category3ListUrl='/admin/product/getCategory3',
}


/**
 * 获取一级分类导航列表
 * @returns  CategoryList
 */
export const getCategory1ListApi=()=>{
  return request.get<any,CategoryList>(Api.category1ListUrl)
}

/**
 * 
 * @param category1Id  选中的一级分类导航
 * @returns CategoryList
 */
export const getCategory2ListApi=(category1Id:number)=>{
  return request.get<any,CategoryList>(Api.category2ListUrl+`/${category1Id}`)
}

/**
 * 
 * @param category2Id 选中的二级分类导航
 * @returns CategoryList
 */
export const getCategory3ListApi=(category2Id:number)=>{
  return request.get<any,CategoryList>(Api.category3ListUrl+`/${category2Id}`)
}